package router

import (
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server_attence/app/business/application"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server_attence/app/business/attendance"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server_attence/app/business/department"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server_attence/app/business/employee"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server_attence/app/business/holiday"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server_attence/app/business/infoimport"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server_attence/app/business/operatingrecord"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server_attence/app/business/overtime"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server_attence/app/business/vacation"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server_attence/app/middleware"
	"github.com/gin-gonic/gin"
)

func Router2User(r *gin.Engine) {
	routeFront := r.Group("/attendance-api")
	{
		routeFront.POST("/employee-sms-login", employee.LoginSmsEmployee)                           //员工手机+短信验证码登录
		routeFront.POST("/employee-login", employee.LoginEmployee)                                  //员工手机+密码登录
		routeFront.POST("/employee-binding-mobile-check", employee.BindMobileToEmployeeCheck)       //员工绑定手机校验检查
		routeFront.POST("/employee-binding-mobile", employee.BindMobileToEmployee)                  //员工绑定手机
		routeFront.POST("/employee-password-change", employee.EmployeeChangePassword)               //员工变更密码
		routeFront.POST("/employee-password-retrieve", employee.RetrieveEmployeePasswordMsgVerCode) //员工密码找回（重置）

		routeFront.GET("/overtime-types", overtime.QueryOvertimeTypes)          //查询加班类型
		routeFront.GET("/vacation-types", vacation.QueryVacationTypes)          //查询请假类型
		routeFront.GET("/application-types", application.QueryApplicationTypes) //查询请假类型

		routeFront.GET("/department-query-list", department.QueryAllDepartments)     //查询部门列表
		routeFront.GET("/department-query-detail", department.QueryDepartmentDetail) //查询部门详情
		routeFront.GET("/status-types", overtime.QueryStatusTypes)                   //查询状态类型

		routeFront.POST("/isholiday", holiday.IsHoliday) //判断是否为节假日

		routeFront.Use(middleware.TokenCheckEmployee())
		{
			//员工接口
			routeFront.POST("/employee-add", employee.AddNewEmployee)              //添加注册新员工
			routeFront.POST("/employee-update", employee.UpdateEmployee)           //更新员工信息
			routeFront.GET("/employee-query-list", employee.QueryAllEmployees)     //查询员工列表
			routeFront.GET("/employee-query-detail", employee.QueryEmployeeDetail) //查询员工详情
			routeFront.DELETE("/employee-delete", employee.DeleteEmployee)         //删除指定员工

			//记录查询
			routeFront.GET("/query-record-list", operatingrecord.QueryAllOpRecord)      //查询员工列表
			routeFront.GET("/query-record-detail", operatingrecord.QueryOpRecordDetail) //查询员工详情

			//部门操作
			routeFront.POST("/department-add", department.AddNewDepartment)      //添加新部门
			routeFront.POST("/department-update", department.UpdateDepartment)   //更新部门信息
			routeFront.DELETE("/department-delete", department.DeleteDepartment) //删除部门

			//全类申请
			routeFront.GET("/application-query-list", application.QueryApplicationList)        //查询加班列表
			routeFront.GET("/application-query-detail", application.QueryApplicationDetail)    //查询加班详情
			routeFront.POST("/application-add", application.AddNewApplication)                 //添加加班申请
			routeFront.POST("/application-approve", application.ApplicationApprove)            //加班审批
			routeFront.POST("/application-cancel", application.ApplicationCancelOrRecall)      //加班申请撤销
			routeFront.POST("/application-approve-batch", application.ApplicationApproveBatch) //加班批量批量审批

			//加班
			routeFront.GET("/overtime-query-list", overtime.QueryOvertimeList)        //查询加班列表
			routeFront.GET("/overtime-query-detail", overtime.QueryOvertimeDetail)    //查询加班详情
			routeFront.POST("/overtime-add", overtime.AddNewOvertime)                 //添加加班申请
			routeFront.POST("/overtime-approve", overtime.OvertimeApprove)            //加班审批
			routeFront.POST("/overtime-cancel", overtime.OvertimeCancelOrRecall)      //加班申请撤销
			routeFront.POST("/overtime-approve-batch", overtime.OvertimeApproveBatch) //加班批量批量审批

			//请假
			routeFront.GET("/vacation-query-list", vacation.QueryVacationList)        //查询请假列表
			routeFront.GET("/vacation-query-detail", vacation.QueryVacationDetail)    //查询请假详情
			routeFront.POST("/vacation-add", vacation.AddNewVacation)                 //请假申请
			routeFront.POST("/vacation-approve", vacation.VacationApprove)            //假期申请审批
			routeFront.POST("/vacation-cancel", vacation.VacationCancelOrRecall)      //假期申请撤销
			routeFront.POST("/vacation-approve-batch", vacation.VacationApproveBatch) //假期申请批量审批

			//信息导入
			routeFront.POST("/setting-import", infoimport.ImportExcel)
			routeFront.POST("/application-export", infoimport.ExportExcelByMail)

			//考勤统计
			routeFront.POST("/cal-attendance", attendance.CalcAttendanceInfo)
		}
	}
	//monitor.TimingMonitorStart()
}
